<template>
  <div>
    <div class="mui-numbox" data-numbox-min='1' data-numbox-max='9' style="height:25px">
      <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
      <input id="test" class="mui-input-numbox" type="number" :value="initcount" @change="countChanged()" ref="numbox" />
      <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
  </div>
</template>


<script>
  import mui from "../../src/lib/mui/js/mui.js"
  export default {
    mounted() {
      mui(".mui-numbox").numbox()
    },
    methods: {
      countChanged() {
        this.$emit("getcount", parseInt(this.$refs.numbox.value))
        this.$store.commit("UpadateGoodsInfo",{
          id:this.goodsid,
          count:this.$refs.numbox.value
        })
      }
    },
    watch:{
      'max':function(newVue,oldVue){
        mui(".mui-numbox").numbox().setOption('max',newVue)
      }
    },
    props:['initcount']
  }
</script>


<style lang="scss" soped>

</style>